home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWSemEvt / FWScpCal.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  3.8 KB  |  117 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWScpCal.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWSCPCAL_H
  11. #define FWSCPCAL_H
  12.  
  13. #ifndef FWSTDDEF_H
  14. #include "FWStdDef.h"
  15. #endif
  16.  
  17. #ifndef FWTDSTRY_H
  18. #include "FWTDstry.h"
  19. #endif
  20.  
  21. #include "FWTMap.tpp"
  22.  
  23. //========================================================================================
  24. //    Forward Declarations Types
  25. //========================================================================================
  26.  
  27. class FW_CDesc;
  28.  
  29. //========================================================================================
  30. //    Public Callback Types
  31. //========================================================================================
  32.  
  33. typedef FW_Handled (*FWDescCoerceFunc)(const FW_CDesc& sourceDesc, 
  34.                                         ODDescType toType, 
  35.                                         FW_CDesc& resultDesc);
  36.                                         
  37. typedef FW_Handled (*FWDescComparisonFunc)(ODDescType comparisonOperator,
  38.                                             const FW_CDesc& lhDesc,
  39.                                             const FW_CDesc& rhDesc,
  40.                                             FW_Boolean& result);
  41.  
  42. //========================================================================================
  43. //    Private Map Types
  44. //========================================================================================
  45.  
  46. typedef FW_TMap<ODDescType, FWDescCoerceFunc> FW_CPrivDescTypeToCoercionMap;
  47. typedef FW_TPair<ODDescType, FWDescCoerceFunc> FW_CPrivDescTypeToCoercionPair;
  48.  
  49. typedef FW_TMap<ODDescType, FWDescComparisonFunc> FW_CPrivDescTypeToComparisonMap;
  50. typedef FW_TPair<ODDescType, FWDescComparisonFunc> FW_CPrivDescTypeToComparisonPair;
  51.  
  52. //========================================================================================
  53. //    class FW_CDescCoercionCallbacks
  54. //========================================================================================
  55.  
  56. class FW_CDescCoercionCallbacks
  57. {
  58. public:
  59.     static void         RegisterHandler(ODDescType toType, FWDescCoerceFunc func);
  60.     static void         RemoveHandler(ODDescType toType);
  61.     
  62.     static FW_Handled     InvokeHandler(const FW_CDesc& sourceDesc,
  63.                                     ODDescType toType, 
  64.                                     FW_CDesc& coercedDesc);
  65.  
  66. private:
  67.     ~FW_CDescCoercionCallbacks();
  68.     FW_CDescCoercionCallbacks();
  69.     FW_CDescCoercionCallbacks(const FW_CDescCoercionCallbacks& other);
  70.     FW_CDescCoercionCallbacks& operator=(const FW_CDescCoercionCallbacks& other);
  71.  
  72.     static FW_CDescCoercionCallbacks* Instance(FW_Boolean create);
  73.  
  74.     friend class FW_TPrivDestroyer<FW_CDescCoercionCallbacks>;
  75.     
  76. private:
  77.     static FW_CDescCoercionCallbacks*                 fgInstance;
  78.     static FW_TPrivDestroyer<FW_CDescCoercionCallbacks> fgDestroyer;
  79.     
  80.     FW_CPrivDescTypeToCoercionMap                     fMap;
  81. };
  82.  
  83. //========================================================================================
  84. //    class FW_CDescComparisonCallbacks
  85. //========================================================================================
  86.  
  87. class FW_CDescComparisonCallbacks
  88. {
  89. public:
  90.     static void            RegisterHandler(ODDescType comparisonOperator, FWDescComparisonFunc func);
  91.     static void            RemoveHandler(ODDescType comparisonOperator);
  92.     
  93.     static FW_Handled    InvokeHandler(ODDescType comparisonOperator,
  94.                                     const FW_CDesc& lhDesc,
  95.                                     const FW_CDesc& rhDesc,
  96.                                     FW_Boolean& result);
  97.     
  98.  
  99. private:
  100.     FW_CDescComparisonCallbacks();
  101.     ~FW_CDescComparisonCallbacks();
  102.     FW_CDescComparisonCallbacks(const FW_CDescComparisonCallbacks& other);
  103.     FW_CDescComparisonCallbacks& operator=(const FW_CDescComparisonCallbacks& other);
  104.     
  105.     static FW_CDescComparisonCallbacks* Instance(FW_Boolean create);
  106.  
  107.     friend class FW_TPrivDestroyer<FW_CDescComparisonCallbacks>;
  108.     
  109. private:
  110.     static FW_CDescComparisonCallbacks*                 fgInstance;
  111.     static FW_TPrivDestroyer<FW_CDescComparisonCallbacks>     fgDestroyer;
  112.     
  113.     FW_CPrivDescTypeToComparisonMap                        fMap;
  114. };
  115.  
  116. #endif
  117.